

package com.fortune.cat.resource;

import com.fortune.cat.enums.MenuEnum;
import com.fortune.cat.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;


/**
 * The type Index controller.
 *
 * @author xiaoyu
 */
@Controller
public class PageController {


    /**
     * Index string.
     *
     * @param model the model
     * @return the string
     */
    @GetMapping("/index")
    public String index(final Model model) {
        model.addAttribute("menus", MenuEnum.createMenu(MenuEnum.USER));
        model.addAttribute("user", UserService.currentUser().getUserName());
        return "index";
    }

    @GetMapping("/route.html")
    private String route() {
        return "route";
    }

    @GetMapping("/login")
    private String login() {
        return "login";
    }

    @GetMapping("/home.html")
    private String home() {
        return "home";
    }
}
